package org.mikeliu.exp2.exp6;

import java.util.Scanner;

class Circle
{
	private double radius;
	public Circle() {
		this.radius=0;
	}
	public Circle(double radius)
	{
		this.radius=radius;
	}
	public void setRadius(double r)
	{
		this.radius=r;
	}
	public double getRadius()
	{
		return this.radius;
	}
	public double getArea() 
	{
		return Math.PI*this.radius*this.radius;	
	}
	public double getPerimeter()
	{
		return 2*Math.PI*this.radius;
	}
	@Override
	public String toString()
	{
		return "Circle(r:"+this.radius+")";
	}
}

class Cylinder
{
	private double height;
	private Circle circle;
	public Cylinder() {
		height=0;
		circle.setRadius(0);
	}
	public Cylinder(double height,Circle circle)
	{
		this.height=height;
		this.circle=circle;
	}
	public void setHeight(double height)
	{
		this.height=height;
	}
	public double getHeight()
	{
		return this.height;
	}
	public void setCircle(Circle circle)
	{
		this.circle=circle;
	}
	public Circle getCircle()
	{
		return circle;
	}
	public double getArea()
	{
		return circle.getArea()*2+circle.getPerimeter()*height;
	}
	public double getVolume()
	{
		return circle.getArea()*height;
	}
	@Override
	public String toString()
	{
		return "Cylinder(h:"+height+",Circle(r:"+circle.getRadius()+"))";
	}
	
}
//此类依题意应为Main
public class Exp6
{
    public static void main(String args[])
    {
	        Scanner input = new Scanner(System.in);
	        int n = input.nextInt();
	        for(int i = 0; i < n; i++)
	        {
	            String str = input.next();
	            if(str.equals("Circle")) 
	            {
	                Circle c = new Circle(input.nextDouble());
	                System.out.println("The area of " + c.toString() + " is " + String.format("%.2f",c.getArea()));
	                System.out.println("The perimeterof " + c.toString() + " is "+ String.format("%.2f",c.getPerimeter()));
	            } 
	            else if(str.equals("Cylinder")) 
	            {
	                Cylinder r = new Cylinder(input.nextDouble(), new Circle(input.nextDouble()));
	                System.out.println("The area of " + r.toString() + " is " + String.format("%.2f",r.getArea()));
	                System.out.println("The volume of " + r.toString() + " is " + String.format("%.2f",r.getVolume()));
	            }
	        }
	        input.close();
	    }
	}